package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllSchools", query = "select mySchool from School mySchool"),
		@NamedQuery(name = "findSchoolByAddress", query = "select mySchool from School mySchool where mySchool.address = ?1"),
		@NamedQuery(name = "findSchoolByAddressContaining", query = "select mySchool from School mySchool where mySchool.address like ?1"),
		@NamedQuery(name = "findSchoolByCity", query = "select mySchool from School mySchool where mySchool.city = ?1"),
		@NamedQuery(name = "findSchoolByCityContaining", query = "select mySchool from School mySchool where mySchool.city like ?1"),
		@NamedQuery(name = "findSchoolByCounty", query = "select mySchool from School mySchool where mySchool.county = ?1"),
		@NamedQuery(name = "findSchoolByCountyContaining", query = "select mySchool from School mySchool where mySchool.county like ?1"),
		@NamedQuery(name = "findSchoolById", query = "select mySchool from School mySchool where mySchool.id = ?1"),
		@NamedQuery(name = "findSchoolByIdContaining", query = "select mySchool from School mySchool where mySchool.id like ?1"),
		@NamedQuery(name = "findSchoolByName", query = "select mySchool from School mySchool where mySchool.name = ?1"),
		@NamedQuery(name = "findSchoolByNameContaining", query = "select mySchool from School mySchool where mySchool.name like ?1"),
		@NamedQuery(name = "findSchoolByPhone", query = "select mySchool from School mySchool where mySchool.phone = ?1"),
		@NamedQuery(name = "findSchoolByPhoneContaining", query = "select mySchool from School mySchool where mySchool.phone like ?1"),
		@NamedQuery(name = "findSchoolByPostcode", query = "select mySchool from School mySchool where mySchool.postcode = ?1"),
		@NamedQuery(name = "findSchoolByPostcodeContaining", query = "select mySchool from School mySchool where mySchool.postcode like ?1"),
		@NamedQuery(name = "findSchoolByPrimaryKey", query = "select mySchool from School mySchool where mySchool.id = ?1"),
		@NamedQuery(name = "findSchoolByProvince", query = "select mySchool from School mySchool where mySchool.province = ?1"),
		@NamedQuery(name = "findSchoolByProvinceContaining", query = "select mySchool from School mySchool where mySchool.province like ?1") })
@Table(catalog = "baobaodb", name = "school")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "School")
public class School implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "id", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String id;
	/**
	 */

	@Column(name = "province", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String province;
	/**
	 */

	@Column(name = "city", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String city;
	/**
	 */

	@Column(name = "county", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String county;
	/**
	 */

	@Column(name = "name", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;
	/**
	 */

	@Column(name = "address", length = 100)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String address;
	/**
	 */

	@Column(name = "postcode", length = 20)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String postcode;
	/**
	 */

	@Column(name = "phone", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String phone;

	/**
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 */
	public String getId() {
		return this.id;
	}

	/**
	 */
	public void setProvince(String province) {
		this.province = province;
	}

	/**
	 */
	public String getProvince() {
		return this.province;
	}

	/**
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 */
	public String getCity() {
		return this.city;
	}

	/**
	 */
	public void setCounty(String county) {
		this.county = county;
	}

	/**
	 */
	public String getCounty() {
		return this.county;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 */
	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	/**
	 */
	public String getPostcode() {
		return this.postcode;
	}

	/**
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 */
	public String getPhone() {
		return this.phone;
	}

	/**
	 */
	public School() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(School that) {
		setId(that.getId());
		setProvince(that.getProvince());
		setCity(that.getCity());
		setCounty(that.getCounty());
		setName(that.getName());
		setAddress(that.getAddress());
		setPostcode(that.getPostcode());
		setPhone(that.getPhone());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("province=[").append(province).append("] ");
		buffer.append("city=[").append(city).append("] ");
		buffer.append("county=[").append(county).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("address=[").append(address).append("] ");
		buffer.append("postcode=[").append(postcode).append("] ");
		buffer.append("phone=[").append(phone).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof School))
			return false;
		School equalCheck = (School) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
